{{>licenseInfo}}

package {{package}};

{{#imports}}import {{import}};
{{/imports}}

import {{invokerPackage}}.ApiClient;
import {{invokerPackage}}.ApiResponse;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

{{#x-helidon-v3}}import io.helidon.common.reactive.Single;
import io.helidon.webclient.WebClientResponse;
{{/x-helidon-v3}}{{^x-helidon-v3}}{{!
}}import io.helidon.webclient.api.HttpClientResponse;
{{/x-helidon-v3}}

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

/**
 * {{#appName}}
 * {{{.}}} Test
 *
 * {{/appName}}
 * API tests for {{classname}}
 */
public class {{classname}}Test {

    private static ApiClient apiClient;
    private static {{classname}} api;
    private static final String baseUrl = "http://localhost:8080";

    @BeforeAll
    public static void setup() {
        apiClient = ApiClient.builder().build();
        api = {{classname}}Impl.create(apiClient);
    }

    {{#operations}}
    {{#operation}}
   /**
    * {{summary}}
    {{#notes}}
    * {{.}}
    {{/notes}}
    */
    @Test
    public void {{operationId}}Test() {
        {{#allParams}}
        // TODO - assign values to the input arguments.
        {{{dataType}}} {{paramName}} = null;
        {{/allParams}}

        // TODO - uncomment the following two lines to invoke the service with valid parameters.
        //ApiResponse<{{>operationResponseTypeDecl}}> response = api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
        //response.webClientResponse().await();
        // TODO - check for appropriate return status
        // assertThat("Return status", response.get().status().code(), is(expectedStatus));

        // TODO: test validations
    }

    {{/operation}}
    {{/operations}}
}
